import { getAssetsImage } from "@/utils";
import { FC, memo } from "react";

interface IProps {
  name?: string
  isUnit?: boolean
  unitText?: string
}

const Title: FC<IProps> = memo((props) => {
  const { name = '标题名字', isUnit = false, unitText = '累计：个' } = props
  
  return (
    <div className="p-16px relative">
    <div
      className="w-full h-41px leading-41px pl-34px max-w-472px"
      style={{
        background: `url(${getAssetsImage('dataAsset/title-bg.png')}) center center`,
        backgroundSize: '100% 100%',
      }}
    >
      <span className="text-18px text-[#465E73] font-bold">{ name }</span>
    </div>
    {isUnit && (
      <span className="absolute right-20px bottom-20px text-14px text-[#999]">{ unitText }</span>
    )}
  </div>
  )
})

export default Title